<?php

/***
 * Class ApplicationBootLoaderClass is a minature bootstrap wrapper that
 * allows a developer to write application-specific logic to execute after
 * a controller has been instantiated, but BEFORE it is executed.
 ***/
class CW_ApplicationBootLoaderClass {

   /**
	* Core object registry
	* @access Private
	* @var Object
	*/
	private $Reg;


   /**
	* The currently selected controller
	* @access Public
	* @var Object
	*/
	public $Controller;


   // ! Constructor Method

   /**
	* Instantiates class and defines instance variables.
	*
	* @param Object $Reg Core object registry passed through by reference
	* @author Daniel Wilhelm II Murdoch <wilhelm.murdoch@gmail.com>
	* @since v 1.0.0
	* @access public
	* @return Void
	*/
	public function __construct(&$Reg, &$Controller)
	{
		$this->Reg = &$Reg;
		$this->Controller = &$Controller;
	}


   // ! Executor Method

   /**
	* This method acts as a wrapper to encapsulate controller pre-launch logic
	* within an application.
	*
	* @param None
	* @author Daniel Wilhelm II Murdoch <wilhelm.murdoch@gmail.com>
	* @since v 1.0.0
	* @access Public
	* @return Mixed
	*/
	public function initApplication()
	{
		try
		{
			return $this->Controller->initController();
		}
		catch(CoreException $Exception)
		{
			ErrorClass::add($Exception->get());
		}
	}
}

?>